<%-- 
    Document   : bookDetails
    Created on : Jan 31, 2013, 1:22:09 AM
    Author     : amr
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title> </title>
    </head>
    <body>    
    <center>
        <sql:setDataSource 
            driver="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3308/mydb"
            user="root" password="123456"
            var="books" 
            scope="session" /> 
        <sql:query var="am" dataSource="${books}">
            SELECT * FROM book where isbn = ${param.bookISBN}
        </sql:query>
        <form action="UpdateBook" method="POST" enctype="multipart/form-data">    
            <table>
                <c:forEach items="${am.rows}" var="row">
                    <tr>
                        <td><img src="${row.cover}" width="290" height="90" alt="2"/> </td>
                    </tr> 
                    <tr>
                        <td>upload new cover<input type="file" name="newCover" value="" /></td>
                    </tr> 
                    <tr>
                        <td>Title </td>
                        <td><input type="text" name="book_title" value="${row.title}"/></td>
                    </tr> 
                    <tr>
                        <td>ISBN </td>
                        <td><input type="text" name="book_isbn" value="${row.isbn}" readonly="readonly" /></td>
                    </tr> 
                    <tr>
                        <td>Category </td>
                        <td><input type="text" name="book_category" value="${row.category}" /></td>
                    </tr> 
                    <tr>
                        <td>Auther</td>
                        <td><input type="text" name="book_auther" value="${row.auther}" /></td>
                    </tr> 
                    <tr>
                        <td>stock quantity</td>
                        <td><input type="text" name="book_quantity" value="${row.quantity}" /></td>
                    </tr> 
                    <tr>
                        <td># pages </td>
                        <td><input type="text" name="book_num_pages" value="${row.num_pages}" /></td>
                    </tr> 
                    <tr>
                        <td>price </td>
                        <td><input type="text" name="book_price" value="${row.price}" /></td>
                    </tr> 
                </c:forEach> 
            </table>  
            <input type="submit" value="save changes" />
        </form>
    </center>
</body>
</html>
